<?php

/**
 * This is the short Description for the Class
 *
 * This is the long description for the Class
 *
 * @author		Application Support Group
 * @package		BAMF
 */
class Framework_LoggedInUser extends Framework_Object {

	protected $_attributes ;

	public function __construct( $idField=null, $idValue=null ) {
		parent::__construct() ;

		$this->_attributes = array( 'idField'=>'', 'idValue'=>'' ) ;

		if( is_string( $idField )) {
			$this->_attributes['idField'] = $idField ;
		}

		if( is_numeric( $idValue )) {
			$this->_attributes['idValue'] = $idValue ;
		}
	}





	public function __get( $anAttribute ) {

		$_output = false ;

		if( array_key_exists( $anAttribute, $this->_attributes )) {
			$_output = $this->_attributes[$anAttribute] ;
		} else {
			$_output = Framework_ErrorHandler::raiseError( "Cannot get the requested property.", __METHOD__."::".__LINE__ ) ;
		}

		return $_output ;
	}

	public function __set( $anAttribute, $aValue ) {

		$_output = false ;

		if( array_key_exists( $anAttribute, $this->_attributes )) {
			$this->_attributes[$anAttribute] = $aValue ;
			$_output = true ;
		} else {
			$_output = Framework_ErrorHandler::raiseError( "Cannot set the requested property.", __METHOD__."::".__LINE__ ) ;
		}

		return $_output ;
	}




	public function isLoggedIn() {
		return ( !empty( $this->_attributes['idField'] ) && !empty( $this->_attributes['idValue'] )) ;
	}


	public function __destruct() {
		parent::__destruct() ;
	}

}

?>
